<!--
  - AddAnalysisLib.php
  - v1.01
  - 3/7/11
  -
  -	This inserts an analysis into the database.
  -->
<?php
	/**
	 * 
	 * The function inserts a new analysis to the database table named
	 * 'analysis_request'.
	 * @param unknown_type $name
	 * @param unknown_type $company
	 * @param unknown_type $address
	 * @param unknown_type $telNo
	 * @param unknown_type $casl_num
	 * @param unknown_type $created_by
	 * @param unknown_type $database
	 * @param unknown_type $host
	 * @param unknown_type $login
	 * @param unknown_type $loginpassword
	 */
	function InsertNewAnalysis($name, $company, $address, $telNo, $casl_num,
			$created_by, $database, $host, $login, $loginpassword){ 
		//Create connection. 
		$connect = mysql_connect("localhost", "createanalysis", 
				"createanalysis");	
		if (!$connect) {
			die('Could not connect: ' . mysql_error());
		}
		
		//Set-up and execute query.		
		mysql_select_db("casl", $connect);		
		$query = "INSERT INTO analysis_request (NAME, COMPANY, ADDRESS, TEL_NO, 
				CASL_NUM, CREATED_BY) VALUES ('$name', '$company', '$address', 
				'$telNo', '$casl_num','$created_by')";
		$analysis = mysql_query($query);
		
		//Check data generated.
		if ($analysis == true) {	
			echo "SUCCESSFUL!";
		} else {
			echo "ERROR!";
		}
		
		//Close connection.
		mysql_close($connect);
		if ($analysis == true) {	
			return TRUE;
		} else {
			return FALSE;
		}
	}
?>